<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page pageEncoding="UTF-8" %>
<%@page import="com.cb.web.wasf.sample.web.UserEditState" %>
<%@taglib uri="http://wasf.cb.com/tag" prefix="wasf" %>
<wasf:useTemplate name="template/standard.jsp" title="${state.title}">
    <wasf:defineFragment name="body">
        <wasf:bloc id="connexionBloc" title="Edition utilisateur">
            <wasf:form id="userEdit">
                <table cellpadding="0" cellspacing="0">
                    <tr>
                        <td><label for="login"><span>* </span>Identifiant</label></td>
                        <td><input type="text" id="login" name="login" value="${state.login}"/></td>
                    </tr>
                    <tr>
                        <td><label for="firstName"><span>* </span>Prénom</label></td>
                        <td><input type="text" id="firstName" name="firstName" value="${state.firstName}"/></td>
                    </tr>
                    <tr>
                        <td><label for="lastName"><span>* </span>Nom</label></td>
                        <td><input type="text" id="lastName" name="lastName" value="${state.lastName}"/></td>
                    </tr>
                    <c:if test="${state.creation}">
                        <tr>
                            <td><label for="password"><span>* </span>Mot de passe</label></td>
                            <td><input type="text" id="password" name="password" value="${state.password}"/></td>
                        </tr>
                        <tr>
                            <td><label for="passwordConfirmation"><span>* </span>Confirmation mot de passe</label></td>
                            <td><input type="text" id="passwordConfirmation" name="passwordConfirmation" value="${state.passwordConfirmation}"/></td>
                        </tr>
                    </c:if>
                    <tr>
                        <td><label for="mail"><span>* </span>Mail</label></td>
                        <td><input type="text" id="mail" name="mail" value="${state.mail}"/></td>
                    </tr>
                    <tr>
                        <td><label for="enable">Actif</label></td>
                        <td><input type="checkbox" id="enable" name="enable" value="true"<c:if test="${state.enable}"> checked="checked"</c:if>/></td>
                        </tr>
                        <tr>
                            <td><label>Profils</label></td>
                            <td>
                                <table cellpadding="0" cellspacing="0">
                                <c:forEach items="${state.allProfils}" var="profil">
                                    <tr>
                                        <td>
                                            <input type="checkbox" id="selectedProfils" name="selectedProfils" value="${profil.name}"<c:if test="${state.selectedProfils.contains(profil)}"> checked="checked"</c:if>/>
                                            </td>
                                            <td>
                                            <c:out value="${profil.name}"/>
                                        </td>
                                    </tr>
                                </c:forEach>
                            </table>
                        </td>
                </table>
                <div style="text-align: right">
                    <wasf:submitButton id="saveButton" caption="Valider" event="save"/>
                    <wasf:submitButton id="cancelButton" caption="Annuler" event="cancel"/>
                </div>
            </wasf:form>
            <em>* Champs obligatoires</em>
        </wasf:bloc>
    </wasf:defineFragment>
</wasf:useTemplate>